unit TimeCheck;

interface
uses classes, windows, sysutils;

type TTimeCheck = class(TObject)
  private
    fElaspedTime, fSp: LongWord;
    fElapedTime: integer;
    function getElaspedTimeStr: string;
    function getElaspedSec: integer;
    function getElaspedSecStr: string;
  protected
  public
    procedure Start;
    procedure Stop;
    procedure Split;
    property ElaspedMSec: integer read fElapedTime;
    property ElaspedMSecStr: string read getElaspedTimeStr;
    property ElaspedSec: integer read getElaspedSec;
    property ElaspedSecStr: string read getElaspedSecStr;
  published
end;

implementation

{ TTimeCheck }

function TTimeCheck.getElaspedSec: integer;
begin
  Result := Trunc(fElapedTime / 1000);
end;

function TTimeCheck.getElaspedSecStr: string;
begin
  Result := formatFloat('#,##0.00', fElapedTime / 1000 );
end;

function TTimeCheck.getElaspedTimeStr: string;
begin
  Result := formatFloat('#,##0',fElapedTime);
end;

procedure TTimeCheck.Split;
begin
  fElapedTime := GetTickCount - fSp;
  fSP := GetTickCount;
end;

procedure TTimeCheck.Start;
begin
  fSp := GetTickCount;
end;

procedure TTimeCheck.Stop;
begin
  fElapedTime := GetTickCount - fSp;
end;

end.
